<template>
	<view class="main">
		<view class="mt">
			<img class="mtbg"
				src="https://www.ysrs.xyz/apiI/ll/file/preview/1744007444236ff80808195d597d901960ef1b70c0026.png" />
			<view class="mtc">沁水县人民医院</view>
		</view>

		<view class="mv" v-if="info.type ==2">
			<view class="mvt">检查结果信息</view>
			<view class="mvi">
				<view class="mvil">检查编号</view>
				<view class="mvir">{{mainData.code}}</view>
			</view>
			<view class="mvi">
				<view class="mvil">报告姓名</view>
				<view class="mvir">{{mainData.name}}</view>
			</view>
			<view class="mvi">
				<view class="mvil">检查类型</view>
				<view class="mvir">{{mainData.type}}</view>
			</view>
			<view class="mvi">
				<view class="mvil">检查时间</view>
				<view class="mvir">{{mainData.time}}</view>
			</view>
			<view class="mvi">
				<view class="mvil">检查项目</view>
				<view class="mvir">{{mainData.xiangmu}}</view>
			</view>
			<view class="mvi"  style="border-bottom: 0;">
				<view class="mvil">检查部位</view>
				<view class="mvir">{{mainData.buwei}}</view>
			</view>
			<view class="mvt">检查情况</view>
			<view class="mvc" style="border-bottom: 0;">{{mainData.info}}</view>
			<view class="mvt">检查结果</view>
			<view class="mvc">{{mainData.res}}</view>
		</view>

		<view class="mc" v-else>
			<view class="mct">
				<view class="mcti" v-for="(i,o) in mainData.title" :key="o">{{i}}</view>
			</view>
			<view class="mcis">
				<view class="mci" v-for="(i,o) in mainData.list" :key="o">
					<view :class="['mcia','mcia'+i.type]">{{i.name}}</view>
					<view :class="['mcia','mcia'+i.type]">{{i.res}} {{i.type == 2 ? '↑' :i.type== 1 ? '↓':''}}</view>
					<view :class="['mcia','mcia'+i.type]">{{i.cankao}}</view>
				</view>
			</view>
		</view>

		<view class="openbv">
			<view class="openb" @click="openPdf">查看PDF电子报告</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {},
				mainData: {
					code: 46551992,
					name: '张三',
					type: 'CT',
					time: '2024-03-13 13:13',
					buwei: '胸部CT平扫',
					xiangmu: '放射报告',
					info: '胸廓对称，纵隔气管居中。右肺中叶切除术后，右肺门局部见吻合线影，中叶支气管截断，右肺见些许索条影;双肺散在微小结节，大者位于左肺尖(im43)，呈磨玻璃密度，径约5mm，右侧胸膜局限性增厚，双侧胸腔无积液。纵隔内未见肿大淋巴结。冠状动脉走行区见钙化。所见左侧乳腺点状钙化，邻近腺体肥厚。肝脏内散在低密度灶，大者长径约7mm。',
					res: '1、符合右肺术后改变，较2024-09-27相仿。 2、双肺微小结节，较前变化不明显，请结合临床建议密切随诊。 3、右肺散在纤维灶，右侧胸膜局。',
					title: ['检验项目', '结果值', '参考值'],
					list: [{
							name: '白细胞',
							res: '6.8310^9/L',
							cankao: '3.5~9.15^9/L',
							type: 0
						},
						{
							name: '中性细胞比率',
							res: '70.5%',
							cankao: '40~75%',
							type: 0
						},
						{
							name: '淋巴细胞比率',
							res: '22.2%',
							cankao: '20%-50%',
							type: 0
						},
						{
							name: '单核细胞比率',
							res: '6.2%',
							cankao: '3%-10%',
							type: 0
						},
						{
							name: '嗜酸性细胞比率',
							res: '1.2%',
							cankao: '0.4%-8%',
							type: 0
						},
						{
							name: '嗜碱性细胞比率',
							res: '2.2%',
							cankao: '0%-1%',
							type: 2
						},
						{
							name: '中性细胞数',
							res: '4.8210^9/L',
							cankao: '1.8~6.310^9/L',
							type: 0
						},
						{
							name: '淋巴细胞数',
							res: '1.5210^9/L',
							cankao: '1.1~3.210^9/L',
							type: 0
						},
						{
							name: '单核细胞',
							res: '0.3810^9/L',
							cankao: '0.1~0.610^9/L',
							type: 0
						},
						{
							name: '嗜酸性粒细胞',
							res: '0.0910^9/L',
							cankao: '0.02~0.5210^9/L',
							type: 0
						},
						{
							name: '嗜碱性粒细胞',
							res: '0.0210^9/L',
							cankao: '0-0.0610^9/L',
							type: 0
						},
						{
							name: '红细胞',
							res: '3.7910^12/L',
							cankao: '3.8~5.110^12/L',
							type: 1
						},
						{
							name: '血红蛋白',
							res: '113g/L',
							cankao: '115~150g/L',
							type: 1
						},
						{
							name: '红细胞压积',
							res: '34.1%',
							cankao: '35~45%',
							type: 1
						},
					]
				}
			}
		},
		onLoad(o) {
			this.info = JSON.parse(o.info)
			uni.setNavigationBarTitle({
				title: this.info.name
			})
		},
		methods: {
			openPdf() {
				// uni.downloadFile({
				// 	url: '',
				// 	success: res => {
				// 		uni.openDocument({
				// 			filePath: res.tempFilePath,
				// 			success: (res) => {}
				// 		})
				// 	}
				// })
			}
		},

	}
</script>


<style scoped lang="scss">
	.main {
		min-height: 100vh;
		background-color: #fff;
		padding-bottom: 40rpx;
	}


	.mt {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 120rpx;
		background-color: #2c9b94;

		.mtbg {
			width: 80rpx;
			height: 80rpx;
			margin-right: 30rpx;
		}

		.mtc {
			color: #fff;
			font-weight: bold;
			font-size: 35rpx;
		}
	}

	.mv {
		padding: 20rpx;

		.mvt {
			color: #2c9b94;
			font-size: 33rpx;
			font-weight: bold;
			text-align: center;
			height: 80rpx;
			line-height: 80rpx;
			border: 1px solid #ccc;
		}

		.mvi {
			display: flex;
			align-items: center;
			height: 80rpx;
			padding: 0 20rpx;
			line-height: 80rpx;
			border: 1px solid #ccc;
			border-top: 0;

			.mvil {
				width: 50%;
				box-sizing: border-box;
				color: #2c9b94;

			}

			.mvir {
				width: 50%;
				box-sizing: border-box;
			}
		}

		.mvc {
			line-height: 46rpx;
			padding: 20rpx;
			border: 1px solid #ccc;
			border-top: 0;
			color: #000;
		}
	}


	.mc {
		padding: 20rpx;

		.mct {
			display: flex;
			align-items: center;

			.mcti {
				border: 1px solid #ccc;
				border-left: 0;
				text-align: center;
				width: 33%;
				height: 60rpx;
				line-height: 60rpx;

				&:first-of-type {
					border-left: 1px solid #ccc;
				}
			}
		}

		.mcis {
			.mci {
				display: flex;
				align-items: center;

				.mcia {
					width: 33%;
					text-align: center;
					font-size: 30rpx;
					height: 80rpx;
					border: 1px solid #ccc;
					border-left: 0;
					border-top: 0;
					word-break: break-all;
					display: flex;
					align-items: center;
					justify-content: center;

					&:first-of-type {
						border-left: 1px solid #ccc;
					}
				}

				.mcia1 {
					color: #4f8dff;
				}

				.mcia2 {
					color: #ff3737;
				}
			}
		}
	}

	.openbv {
		width: 100%;

		.openb {
			width: 400rpx;
			height: 60rpx;
			text-align: center;
			line-height: 60rpx;
			color: #fff;
			background-color: #2c9b94;
			border-radius: 12rpx;
			margin: 40rpx auto;
		}
	}
</style>